package cn.itcast.nems.product.dao.dataobject;

/**
 * 产品编号，班级为：C-clazz_id(班级ID)，如：C-1234
 * 班级阶段为：C-clazz_id(班级ID)-P-clazz_phase_id(阶段ID)-phase(第几阶段)，如：C-1234-P-2345-2
 * author: yong.li
 * create: 2023-08-25 15:23:27
 **/
public class BizNo {
    private int clazzId;
    private int phaseId;
    private int phase = 1;

    public BizNo(String str) {
        final String[] strs = str.split("-");
        this.clazzId = Integer.parseInt(strs[1]);
        if (strs.length > 4) {
            this.phaseId = Integer.parseInt(strs[3]);
            this.phase = Integer.parseInt(strs[4]);
        }
    }

    public static String calBizNo(int clazzId){
        return "C-" + clazzId;
    }

    public int getClazzId() {
        return clazzId;
    }

    public int getPhaseId() {
        return phaseId;
    }

    public int getPhase() {
        return phase;
    }
}
